package circulate_algorithm_study;

import java.math.BigInteger;
import java.util.Scanner;

public class Factorial_Number {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        BigInteger sum = new BigInteger("0");
        for (int i = 1; i <= n; i++) {
            BigInteger jc = (jieCheng(i));
            sum = jc.add(sum);
        }
        System.out.println(sum);
    }

    static BigInteger jieCheng(int y) {
        BigInteger jc = new BigInteger("1");
        for (int i = 1; i <= y; i++) {
            jc = jc.multiply(new BigInteger(String.valueOf(i)));
        }
        return jc;
    }


}
